#!/usr/bin/env python

#   Trolls Outta Luckland v1.1.0
#   Copyright 2009-2010, Gummbum
#
#   This file is part of Trolls Outta Luckland.
#
#   Trolls Outta Luckland is free software: you can redistribute it
#   and/or modify it under the terms of the GNU General Public License
#   as published by the Free Software Foundation, either version 3 of
#   the License, or (at your option) any later version.
#
#   Trolls Outta Luckland is distributed in the hope that it will be
#   useful, but WITHOUT ANY WARRANTY; without even the implied warranty
#   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with Trolls Outta Luckland.  If not, see
#   <http://www.gnu.org/licenses/>.

"""
"""

import os
from os.path import join as join_path

__version__ = '1.1.0'

try:
    ### Pygame imports
    import pygame
    from pygame.locals import (
        Color, NOFRAME, FULLSCREEN, HWSURFACE, DOUBLEBUF,
        USEREVENT, NUMEVENTS,
    )
except ImportError, e:
    print 'ImportError: %s' % e
    print '    in file "%s"' % os.path.abspath(sys.argv[0])

### Display settings
DISPLAY_FLAGS = FULLSCREEN
WINDOW_WIDTH,WINDOW_HEIGHT = 800,768
# TITLE_FONT: Trolls Outta Luckland
# SYSTEM_FONT: Game loading, high score headers
# TEXT_FONT: Intro and headers
# MENU_FONT: Menus
# GAME_FONT: Pilot name, wave, and score
# HUD: Game HUD, Debug HUD, now playing
# FPS: 500 fps!
TITLE_FONT = ('Jann2.ttf',44,False)
SYSTEM_FONT = ('vibroceb.ttf',24,False)
TEXT_FONT = ('YOUTTX__.ttf',22,False)
MENU_FONT = ('Jann2.ttf',26,False)
GAME_FONT = ('kaliberr.ttf',24,False)
HUD_FONT = ('Folks-Light.ttf',12,False)
FPS_FONT = ('Folks-Light.ttf',12,False)
SCORE_FONT1 = ('Folks-Heavy.ttf',12,False)
SCORE_FONT2 = ('Folks-Heavy.ttf',14,False)
SCORE_FONT3 = ('Folks-Heavy.ttf',18,False)
SCORE_FONT4 = ('Folks-Heavy.ttf',22,False)
SCORE_FONT5 = ('Folks-Heavy.ttf',27,False)
# flags - set the index to choose window mode
# window border color and gradient (str, tuple, or Color)
BORDER_COLOR = 'black'
BORDER_GRADIENT = (
    'violet',
    (164,89,164),   # darker violet
    (119,56,119),   # **Gummbum's fave purple
    (87,41,87),     # darker darker violet
    'cyan',
    'red4',
    'firebrick4',
)[2]
VISIBLE_MOUSE = False

### Game settings
# Load psyco JIT compiler in __main__. In general, enabling this shouldn't
# hurt. But if you get buggy behavior you can disable it here.
USE_PSYCO = True
# valid volume level=0.0 to 1.0
MASTER_VOLUME = 0.6
FX_VOLUME = 0.6
MUSIC_VOLUME = 0.7
# sound types for gumm_sound.Jukebox
(SOUND_FX,SOUND_MUSIC) = range(2)
# 0=use runtime benchmark; 60 to LIGHT_SPEED=specify max FPS
# Setting FPS too high will likely result in hiccups. Try to leave 10%
# CPU overhead for Python code and garbage collection.
FPS = 0
# FPS can never exceed this. Game speed is derived. Lower LIGHT_SPEED to slow
# subjective game speed; raise it to hasten. Game is tuned for around 120-130.
LIGHT_SPEED = 130
GAME_STATES = (
    FIRST,
    NEW,
    POST_MENU,
    GET_MENU,
    START,
    PLAY,
    END,
    HIGHSCORES,
    HELP,
) = range(9)
SONG_ENDED_EVENT = USEREVENT+1
# For the sign-on GUI:
#   RUBOUT='_': represents the "rubout" character, aka blank
#   PLAYER_NAME_DEFAULT=RUBOUT*7: initializes the default player name to fixed
#       length of rubout characters; dictates max length of player name
RUBOUT = '_'
PLAYER_NAME_DEFAULT = RUBOUT * 8
# User game files will be saved in USER_DIR. This is taken from the environment.
HOME_DIR = os.path.expanduser('~')
USER_DIR = os.path.join(HOME_DIR, '.trollsouttaluckland')
SAVE_FILE = os.path.join(USER_DIR, 'save.dat')
SETTINGS_FILE = os.path.join(USER_DIR, 'settings.dat')

### Player ship settings
(SHOOTING_FORE,SHOOTING_AFT,SHIPMAXSTATE) = (
    0x01,
    0x02,
    0xFF
)
# Player move: pixels per tick (int or float)
PLAYER_SPEED = 1.5
# Player shots: rate at which shots can be queued and fired (int)
INPUT_RATE = 30
FIRE_RATE = 45
# Number of mouse clicks to queue (int=1 or higher; recommend 1 to 2)
MOUSE_QUEUE_DEPTH = 1
# Laser shot move: pixels per tick (int or float)
LASER_SHOT_SPEED = 2 #1.75 #1.5
# Max shots on screen (int)
LASER_SHOTS = 3
# Begin each new game with this many lives (int)
INITIAL_LIVES = 3
# Max lives that can be "banked" during game play (int); NB: graphics
# do not auto-adjust, therefore the graphics have room for 5 at most
MAX_LIVES = 5

### Enemy settings
# Max shots on screen per enemy (int)
ENEMY_MAX_SHOTS = 5
# Longest potential delay between laser shots (int)
ENEMY_FIRE_RATE = 70
# Enemy move: pixels per tick (int or float)
ENEMY_SPEED = 0.75

### Global instance of Game - set explicitly by main() and read explicitly
### by classes that need access to the Game runtime data
game = None

### Debug settings
# Display debug HUD and execute additional runtime code for debugging:
#   * Keys 0-9 toggle path drawing for enemies
#   * I toggles player invicibility
#   * K new sky
#   * L skips to next wave
#   * P pauses the game
#   * V toggles mouse pointer visibility
DEBUG = False
# Coder expedience: skip some theatrical but time-consuming areas. This can
# be set to True (no signon, welcome, music), False (full game content), or
# DEBUG (coincide with debug setting).
CODER_PASS = False
